package com.hps.springmvc.service.impl;

import com.github.pagehelper.PageHelper;
import com.hps.springmvc.mapper.SeckillMapper;
import com.hps.springmvc.model.Seckill;
import com.hps.springmvc.service.SeckillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

@Service
public class SeckilServiceImpl implements SeckillService {

    @Autowired
    private SeckillMapper seckillMapper;

    @Transactional
    @Override
    public List<Seckill> getAll() {
        PageHelper.startPage(1, 2);
        return seckillMapper.selectAll();
    }

    @Override
    public Seckill getById(Long seckillId) {
        return seckillMapper.selectByPrimaryKey(seckillId);
    }
}
